package models

import (
	"time"
)

// OrderItem 订单明细表
type OrderItem struct {
	ID               uint64     `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"`
	OrderID          uint64     `gorm:"not null;index;comment:订单ID" json:"order_id"`
	ItemType         int8       `gorm:"type:tinyint;not null;index;comment:商品类型(1-租金,2-押金,3-服务费,4-水电费,5-物业费,6-其他费用)" json:"item_type"`
	ItemName         string     `gorm:"type:varchar(200);not null;comment:商品名称" json:"item_name"`
	ItemDesc         string     `gorm:"type:varchar(500);comment:商品描述" json:"item_desc"`
	UnitPrice        float64    `gorm:"type:decimal(10,2);not null;comment:单价" json:"unit_price"`
	Quantity         float64    `gorm:"type:decimal(10,2);not null;default:1;comment:数量" json:"quantity"`
	Amount           float64    `gorm:"type:decimal(10,2);not null;comment:金额" json:"amount"`
	BillingCycle     int8       `gorm:"type:tinyint;comment:计费周期(1-月,2-季,3-年,4-一次性)" json:"billing_cycle"`
	BillingStartDate time.Time  `gorm:"type:date;comment:账单开始日期" json:"billing_start_date"`
	BillingEndDate   time.Time  `gorm:"type:date;comment:账单结束日期" json:"billing_end_date"`
	IsPaid           int8       `gorm:"type:tinyint;default:0;index;comment:是否已支付(0-否,1-是)" json:"is_paid"`
	PaidAt           *time.Time `gorm:"type:timestamp;comment:支付时间" json:"paid_at"`
	CreatedAt        time.Time  `gorm:"autoCreateTime;comment:创建时间" json:"created_at"`
	UpdatedAt        time.Time  `gorm:"autoUpdateTime;comment:更新时间" json:"updated_at"`
}
